package aegis.feedss.paylib.uppay;

import android.text.TextUtils;

import aegis.feedss.paylib.PayInfo;


/**
 * 构建支付参数，主要是银行返回的 TN，即 ：订单信息为交易流水号。
 *
 * Author ： Aegis_Lee
 * Date   ： 2016/8/1.
 * Email  :  476810504@qq.com
 */
public class PayUrlGenerator {

    private PayInfo payInfo;


    public PayUrlGenerator(PayInfo payInfo) {
        this.payInfo = payInfo;
    }

    public String genPayOrder() {

        validatePayInfo(payInfo);

        return payInfo.getOrderNo();
    }


    /**
     * 验证 支付参数的有效性
     *
     * @param payInfo
     * @return void
     * @autour BaoHong.Li
     * @date 2015-7-17 上午10:44:11
     * @update (date)
     */
    private void validatePayInfo(PayInfo payInfo) {

        if (TextUtils.isEmpty(payInfo.getOrderNo())) {
            throw new IllegalArgumentException(" payInfo.orderNo is  null !");
        }

        //		if (TextUtils.isEmpty(payInfo.getBody())) {
        //			throw new IllegalArgumentException(" payInfo.body is  null !");
        //		}

        //		if (TextUtils.isEmpty(payInfo.getSubject())) {
        //			throw new IllegalArgumentException(" payInfo.subject is  null !");
        //		}

        //		if (TextUtils.isEmpty(payInfo.getNotifyUrl())) {
        //			throw new IllegalArgumentException(" payInfo.notifyUrl is  null !");
        //		}

    }

}
